{
*******************************************************************************
-------------------------------------------------------------------------------
Kliper - next generation multimedia player
Copyright (C) Marcin 'vi4m' Kliks (vi4m@wp.pl)
Copyright (C) Tomasz 'dymsza' Odrobny (dymsza@gmail.com)
-------------------------------------------------------------------------------
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*******************************************************************************
}

unit fileselect;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, utils;

type
  TFrmSelectFile = class(TForm)
    ListBox1: TListBox;
    BtnOk: TButton;
    btnCancel: TButton;
    procedure ListBox1DblClick(Sender: TObject);
    procedure BtnOkClick(Sender: TObject);
    procedure btnCancelClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private

    lista_: TStringList;
    { Private declarations }
  public
    { Public declarations }
    procedure show2(lista: TStringList);
  end;

var
  FrmSelectFile: TFrmSelectFile;

implementation
uses Math, main;
{$R *.dfm}

procedure TFrmSelectFile.show2(lista: TStringList);
var
  i: integer;


begin
  ListBox1.Items := lista;
  lista_ := lista;
  if ListBox1.Count > 0 then
    for i := 0 to ListBox1.Count - 1 do
    begin
      ListBox1.Items.Strings[i] := extractfilename(ListBox1.Items.Strings[i]);
    end;



  ShowModal;
end;

procedure TFrmSelectFile.ListBox1DblClick(Sender: TObject);
begin
  if ListBox1.ItemIndex > -1 then
    mainform.subs.loadsub(lista_.Strings[ListBox1.itemindex], true);
  close;
end;

procedure TFrmSelectFile.BtnOkClick(Sender: TObject);
begin
  ListBox1.OnDblClick(nil);
end;

procedure TFrmSelectFile.btnCancelClick(Sender: TObject);
begin
  Close;
end;

procedure TFrmSelectFile.FormShow(Sender: TObject);
begin
  mainform.loadlanguage('frmselectfile', 'lang\' + getLang);
end;

end.
